package fun.werfamily.wf.goods.core.api;

import fun.werfamily.wf.base.vo.Result;
import fun.werfamily.wf.goods.core.domain.dto.request.BannerReqDTO;
import fun.werfamily.wf.goods.core.domain.dto.response.BannerDTO;
import fun.werfamily.wf.goods.core.domain.service.HomeService;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: Mr.WenMing Zhang
 * @Date: 2022-04-27 14:13
 * @Description:
 */
@Slf4j
@RestController
@RequestMapping("/open/banner")
public class BannerApiController {

    @Resource
    private HomeService homeService;

    @ApiOperation("banner列表")
    @PostMapping("/list")
    public Result<List<BannerDTO>> getBannerList(@RequestBody @Valid BannerReqDTO bannerReqDTO){
        log.info("banner列表入参,[/api/banner/list],req={}", bannerReqDTO);
        return Result.success(homeService.listBanner(bannerReqDTO));
    }
}
